How delete an assembly after loading

How delete an assembly after loading


You can not delete the file after loading. It may show the following error:
    Additional information: Access to the path 'XXX' is denied.

The reason is that the file is in use. So you can use LOAD instead LOADFROM, as shown below:
Assembly.LoadFrom(path);
Assembly.Load(File.ReadAllBytes(path));
Seyed Hamed Vahedi Seyed Hamed Vahedi     Wed, 2 January, 2019